package parameters

// SendNewPostParams 创建新的帖子参数
type SendNewPostParams struct {
	Title       string `binding:"required" json:"title" db:"title"`
	Description string `binding:"required" json:"description" db:"description"`
	Content     string `binding:"required" json:"content" db:"content"`
	CommunityId string `binding:"required" json:"community_id" db:"community_id"`
	AuthorId    string `json:"author_id" db:"author_id"` // 用于传递从ctx存值的！
	Status      int8   `binding:"required,oneof=1 2 3" json:"status" db:"status"`
	Cover       int64  `binding:"required" json:"cover" db:"cover"`
}

// UpdatePostParams 更新帖子参数
type UpdatePostParams struct {
	PostId      string `json:"post_id" binding:"required"`
	Title       string `binding:"required" json:"title" db:"title"`
	Description string `binding:"required" json:"description" db:"description"`
	Content     string `binding:"required" json:"content" db:"content"`
	CommunityId string `binding:"required" json:"community_id" db:"community_id"`
	Cover       string `binding:"required" json:"cover" db:"cover"`
	Status      int8   `binding:"required,oneof=1 2 3" json:"status" db:"status"`
}

// GetPostListByFilterParams 分页查询帖子参数
type GetPostListByFilterParams struct {
	PageSize    int    `form:"page_size" json:"page_size" binding:"required"`
	PageNumber  int    `form:"page_number" json:"page_number" binding:"required"`
	Title       string `json:"title,omitempty" form:"title,omitempty" db:"title" sql:"like"`
	CommunityId string `json:"community_id,omitempty" form:"community_id,omitempty" db:"community_id"`
	AuthorId    string `json:"author_id,omitempty" form:"author_id,omitempty" db:"author_id"`
	Sort        string `form:"sort" json:"sort" binding:"required"`
	SortMode    string `json:"sort_mode" form:"sort_mode" binding:"oneof=asc desc"`
}

// VotePostParams 投票参数！
type VotePostParams struct {
	//PostId 帖子id
	PostId string `json:"postId" binding:"required"`
	//Direction 投票赞成1/反对票-1/取消投票0
	Direction *int8 `json:"direction" binding:"required,oneof=1 0 -1"`
	// 用于参数接受！ctx user id
	UserId string `json:"user_id"`
}
